E-Tech Timer / E-Tech Timer / renameCountdown.vbon commit add archived files (d846247)
   1Imports System.Windows.Forms
   2
   3Public Class renameCountdown
   4
   5    Private Sub renameCountdown_Load(sender As Object, e As EventArgs) Handles MyBase.Load
   6        Dim selItem As String
   7        Dim strArr() As String
   8        strArr = countdown.KryptonListBox1.SelectedItem.Split("|")
   9        selItem = (strArr(0).ToString)
  10        TextBox1.Text = selItem.Substring(0, selItem.Length - 1)
  11    End Sub
  12
  13    Private Sub KryptonButton2_Click(sender As Object, e As EventArgs) Handles KryptonButton2.Click
  14        Me.Close()
  15    End Sub
  16
  17    Private Sub KryptonButton1_Click(sender As Object, e As EventArgs) Handles KryptonButton1.Click
  18        Dim selItem As String
  19        Dim strArr() As String
  20        strArr = countdown.KryptonListBox1.SelectedItem.Split("| ")
  21        selItem = (strArr(1).ToString)
  22        countdown.KryptonListBox1.Items.Remove(countdown.KryptonListBox1.SelectedItem)
  23        countdown.KryptonListBox1.Items.Add(TextBox1.Text & " | " & selItem)
  24        Me.Close()
  25    End Sub
  26
  27    Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown
  28        If e.KeyCode = Keys.Enter Then
  29            Dim selItem As String
  30            Dim strArr() As String
  31            strArr = countdown.KryptonListBox1.SelectedItem.Split("| ")
  32            selItem = (strArr(1).ToString)
  33            countdown.KryptonListBox1.Items.Remove(countdown.KryptonListBox1.SelectedItem)
  34            countdown.KryptonListBox1.Items.Add(TextBox1.Text & " | " & selItem)
  35            Me.Close()
  36        End If
  37
  38        If e.KeyCode = Keys.Escape Then
  39            Me.Close()
  40        End If
  41    End Sub
  42End Class